<?php

namespace App\Livewire\Components;

use Livewire\Component;

class ArticleHot extends Component
{
    public function render()
    {
        $hotArticles = \App\Models\Article::query()
            ->select(['id', 'category_id', 'title', 'description', 'reading_quantity', 'comment_quantity'])
            ->with('category')
            ->orderByDesc('reading_quantity')
            ->limit(5)
            ->get();
        return view('livewire.components.article-hot', [
            'hot_articles' => $hotArticles,
        ]);
    }
}
